// pages/refundAudit/refundADetail.js
var $ = require('../util/commit.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    param:{},
    refundData:{}
   
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that=this;
    let param=JSON.parse(options.data);
    that.setData({
      param,
    });
    that.loadData();
  },
loadData:function(e){
  let that=this;
  $.POST({
    url:'cuid',
    data:{
      cuid:that.data.param.id,
    }
  },function(e){
    that.setData({
      refundData:e.data
    })
  },function(e){})
},
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  callPhone: function (e) {
    wx.makePhoneCall({
      phoneNumber: e.currentTarget.dataset.phone,
      success: function () {
        console.log('拨打电话成功')
      },
      fail: function () {
        console.log('拨打电话失败!')
      }
    })
  },
  unAgree: function (e) {
    let that = this;
    $.POST({
      url: 'caCRA',
      data: {
        cuid: e.currentTarget.dataset.id,
        caid: that.data.param.caid,
        status: 2
      }
    }, function (e) {
      wx.showToast({
        title: e.msg,
        icon: 'none'
      });
      that.loadData();
    }, function (e) { });
  },
  Agree: function (e) {
    let that = this;
    $.POST({
      url: 'caCRA',
      data: {
        cuid: e.currentTarget.dataset.id,
        caid: that.data.param.caid,
        status: 1
      }
    }, function (e) {
      wx.showToast({
        title: e.msg,
        icon: 'none'
      });
      that.loadData();
    }, function (e) { });
  }
})